1. Field of the Invention
The present invention relates to a communication system, and more particularly, to a routing device.
2. Description of the Prior Art
With the rapid development of networks, the routing technique and the application of routers become more and more important.
A router is typically connected to several networks, and the connection situations between the networks are recorded in a routing table. In a conventional router, each row of the routing table represents a route of a data packet that is to be transmitted outward from the router. The destination information of the route, such as a destination IP address, network mask (or subnet), and nexthop are recorded in the row. When a data packet is received, the router looks up a nexthop for the data packet from the routing table according to the destination IP address recorded in the header of the data packet. The router then transmits the data packet to the nexthop. Being continually transmitted through different routers, the data packet is eventually transmitted to the destination IP address.
However, there may be many alternative routes to transmit the same data packet, i.e. a single destination IP address may correspond to a plurality of alternative nexthops. In the prior art, the router records the relationship between the destination IP address and the plurality of nexthops in a plurality of rows of the routing table, respectively. As a result, the routing table of the prior art is recorded with duplicate destination IP addresses and network masks so that the usage efficiency of the memory in the router is thereby decreased.